//
//  WellcomeViewController.swift
//  ZYBWeibo
//
//  Created by xthink4 on 16/3/4.
//  Copyright © 2016年 zyb. All rights reserved.
//

import UIKit
import SDWebImage

class WellcomeViewController: UIViewController {

    @IBOutlet weak var titleLable: UILabel!
    @IBOutlet weak var bottomConstraint: NSLayoutConstraint!
    @IBOutlet weak var userIcon: UIImageView!
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let urlString=NSUserDefaults.standardUserDefaults().objectForKey("avatar_hd") as! String
        userIcon.sd_setImageWithURL(NSURL(string: urlString))
    }
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        bottomConstraint.constant=view.bounds.size.height-bottomConstraint.constant
       
        
        UIView.animateWithDuration(2.0, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 5.0,options:UIViewAnimationOptions.TransitionNone,animations: { (_) in
            self.view.layoutIfNeeded()
            }) { (_)in
                UIView.animateWithDuration(1.0, animations: { ()in
                   self.titleLable.alpha=1.0
                    }, completion: { (_) in
                        NSNotificationCenter.defaultCenter().postNotificationName(YBSwithRootViewControllerNSNotification, object: "Main")
                })
        }
           }

  }
